﻿<?php
$v_number_of_qa = sizeof($arr_all_qa_by_agency);
$v_current_style_name = "odd_row";
$v_next_style_name="";
$v_url_send_question = "index.php?fuseaction=DISPLAY_SINGLE_QA_QUESTION_FOR_SENDING&agency_id=".$v_agency_id."&cate_id=".$v_cate_id;
?>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="page_title">
		<td colspan="2"><?php echo CONST_QA_LIST_ALL_CATE_TITLE.">>".$v_cate_name; ?></td>
	</tr>
	<tr> 
		<td class="send_qa_link" colspan="4">
			<a href="<?php echo $v_url_send_question;?>"><?php echo CONST_QA_QUESTION_FOR_ANSWER_TITLE;?></a>&nbsp;&nbsp;&nbsp;
			<img src="<?php echo $_ISA_IMAGE_URL_PATH?>send_qa.gif">
		</td>
	</tr>	
	<tr class="category_title">
		<td colspan="2"><?php echo $v_agency_name;?><small class="number_label"><?php echo "(".$v_total_qa_count.")"; ?></small></td>
	</tr>		
	<tr><td height="10"></td></tr>
</table><?php
if ($v_total_qa_count >0){?>
	<table class="list_table" width="100%" cellpadding="0" cellspacing="0">
		<col width="5%"><col width="85%">		
		<tr class="header">
			<td align="center"><?php echo CONST_QA_ORDER; ?></td>
			<td align="center"><?php echo CONST_QA_NAME_LABEL; ?></td>
		</tr><?php
		for($v_index = 0; $v_index < $v_number_of_qa ; $v_index++){
			$v_qa_stt= $arr_all_qa_by_agency[$v_index]['0'] + ($page -1) * $v_limit;
			$v_qa_id = $arr_all_qa_by_agency[$v_index]['1'];
			$v_qa_title = $arr_all_qa_by_agency[$v_index]['2'];
			$v_qa_sender_name = _restore_XML_bad_char($arr_all_qa_by_agency[$v_index]['3']);
			$v_qa_sender_date = _yyyymmdd_to_ddmmyyyy($arr_all_qa_by_agency[$v_index]['5']);
			$v_qa_sender_add = _restore_XML_bad_char($arr_all_qa_by_agency[$v_index]['4']);	
			$v_sender_info = $v_qa_sender_name;
			if (strlen(trim($v_qa_sender_add)) > 0){
				$v_sender_info = "( ".$v_sender_info . ', '.$v_qa_sender_add.")";
			}							
			$v_sender_info = "(".$v_sender_info . ',  ng&#224;y '.$v_qa_sender_date.")";
			$v_url = "index.php?fuseaction=DISPLAY_SINGLE_QA_QUESTION&qa_id=" . $v_qa_id;
						
			if ($v_current_style_name == "odd_row"){
				$v_current_style_name = "round_row";
			}else{
				$v_current_style_name = "odd_row";
			}?>		
			<tr class="<?php echo $v_current_style_name ?>"> 
				<td align="center" class="normal_label">
					<?php echo $v_qa_stt;?>
				</td>				
				<td align="left">
				<img src="<?php echo $_ISA_IMAGE_URL_PATH?>doc.gif">
					<a class="normal_label" href="<?php echo $v_url; ?>"><?php echo $v_qa_title;?><small class="normal_label"><?php echo $v_sender_info;?></small></a>&nbsp;
				</td>					
			</tr><?php 
		} // end for
		
		if ($v_current_style_name == "odd_row"){
		$v_next_style_name = "round_row";
		}else{
			$v_next_style_name = "odd_row";
		}
		echo _add_empty_row($v_number_of_qa,CONST_LIMIT_QA_PER_PAGE,$v_current_style_name,$v_next_style_name,2);
		?>
	</table><?php
	if ($v_total_qa_count > $v_limit){ ?>
		<table>
			<tr><td height="10pt"></td></tr>
			<tr>
				<col width="5%"><col width="95%">
				<td align="center" class="normal_label">
					<b><?php
					if ($page == 1)  
						echo "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-left.jpg class=normal_image align=center>"; 
					else            
						echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_QA_BY_AGENCY&agency_id=" .$v_agency_id."&cate_id=" .$v_cate_id."&page=".($page - 1). "\">". "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-left.jpg class=normal_image align=center>" . "</a>";
					
					for ($i = 1; $i <= $pager->numPages; $i++) { 
						echo " | "; 
						if ($i == $pager->page)
							echo $i; 
						else 
							 echo "<a href=\"index.php?fuseaction=DISPLAY_ALL_QA_BY_AGENCY&agency_id=" .$v_agency_id."&cate_id=" .$v_cate_id. "&page=". $i. "\">". $i."</a>";
						}//dong for
					
					if ($page == $pager->numPages) 
						echo " | ". "<img src=" . $_ISA_IMAGE_URL_PATH . "d-arrow-right.jpg class=normal_image align=center>"; 
					else            
						echo " | ". "<a href=\"index.php?fuseaction=DISPLAY_ALL_QA_BY_AGENCY&agency_id=" .$v_agency_id."&cate_id=" .$v_cate_id. "&page=".($page + 1) . "\">" . "<img src=" . $_ISA_IMAGE_URL_PATH . "arrow-right.jpg class=normal_image align=center>" . "</a>";?>
					</b>
				</td>
			</tr>
		</table><?php
	}
}else{ ?>
		<small class="normal_label"><?php echo CONST_NO_QA_MESSAGE; ?></small><?php
}?>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td align="center"><a class="normal_button" href="<?php echo $_URL_BACK?>"><?php echo _CONST_BACK_BUTTON; ?></a>
		</td>
	</tr>
</table>